shortcut controller: Fix mnemonic cycling
authorMatthias Clasen <mclasen@redhat.com>
Thu, 28 May 2020 12:52:55 +0000 (08:52 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 28 May 2020 12:52:55 +0000 (08:52 -0400)
Iterate the shortcuts we found in order, not in
reverse. Otherwise, we always end up activating
the last_selected one, since it is last in the
list.

This broke in fb9b54d4b209afc when a list was
turned into an array.

gtk/gtkshortcutcontroller.c

index 92f244455b7c4348bb7715c608bcd2cd0efec052..81ca7f7b2682f1b07de42b1695e922462784664d 100644 (file)
@@ -373,7 +373,8 @@ gtk_shortcut_controller_run_controllers (GtkEventController *controller,
   if (!shortcuts)
     return retval;
 
-  for (i = shortcuts->len - 1, p = shortcuts->len; i >= 0; i--)
+  p = shortcuts->len;
+  for (i = 0; i < shortcuts->len; i++)
     {
       const ShortcutData *data = &g_array_index (shortcuts, ShortcutData, i);